package com.dasberg.gwt.server;

import com.dasberg.gwt.client.AuthenticationException;
import com.dasberg.gwt.client.AuthenticationToken;
import com.dasberg.gwt.domain.IToken;

/**
 * Stub implementation of the AuthenticationRepository.
 * @author mischa.
 */
public class StubAuthenticationProvider implements AuthenticationProvider {

    /** {@inheritDoc}. */
    public boolean isTokenValid(AuthenticationToken token) {
        return token != null && token.getUsername().equals("admin");
    }

    /** {@inheritDoc}. */
    public IToken authenticate(String username, String password) throws AuthenticationException {
        return null;
    }

    /** {@inheritDoc}. */
    public void deauthenticate(AuthenticationToken token) {
    }

    /** {@inheritDoc}. */
    public boolean isUserInRole(AuthenticationToken token, String role) {
        return false;
    }
}
